<%@ page language="java" contentType="text/html; charset=utf-8"
    pageEncoding="utf-8"%>
<%@ include file="../perEvaluationResult/importhead.jsp" %>
<%@ page import="java.text.*" %>
<%
	int checktypeid = Integer.parseInt(request.getParameter("checktypeid"));
	String checktime = request.getParameter("checktime");
	String classid =request.getParameter("classid");
	List<VCheckReport> list = DAOFactory.getCheckReportDAO().getClassCheckReports(checktypeid, checktime, classid);

	String totalclassname = request.getParameter("totalclassname");
	String schoolname = request.getParameter("schoolname");
	Format f = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
	Date d = (Date)f.parseObject(checktime);
	Format f2 = new SimpleDateFormat("yyyyMMdd");
	String sChecktime = f2.format(d); 
 %>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <link rel="stylesheet" href="../toexcel/css/bootstrap.min.css">
    <link href="https://cdn.bootcss.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet">
    <script src="https://cdn.bootcss.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
    <style>
        body{
            font-family: 宋体;
            font-size: 12px;
            padding-bottom:30px;
        }
        #baseInfo{
            list-style: none;
        }
        #baseInfo li{
            float: left;
            width: 200px;
        }
         table,tr,th{
            padding: 0;
            height: 28px;
            text-align:center;
        }
        table,tr,td{
            padding: 0;
            height: 28px;
            text-align:center;
        }
        .weidu{
            margin-top: 20px;
        }
        
        .MsoNormalTable{
            mso-style-name:普通表格;
            mso-style-parent:"";
            mso-style-noshow:yes;
            mso-tstyle-rowband-size:0;
            mso-tstyle-colband-size:0;
            mso-padding-alt:0.0000pt 5.4000pt 0.0000pt 5.4000pt;
            mso-para-margin:0pt;
            mso-para-margin-bottom:.0001pt;
            mso-pagination:widow-orphan;
            font-family:'Times New Roman';
            font-size:10.0000pt;
            mso-ansi-language:#0400;
            mso-fareast-language:#0400;
            mso-bidi-language:#0400;
        }
    </style>
</head>
<body>
    
    <button type="button" class="btn btn-default" onclick="toExcel()" style="margin:10px 20px">保存为Excel</button>
    <div style="margin:auto;width:90%;">
    <table id="myTable" style="text-align: center; border-collapse:collapse;width:100%;mso-table-layout-alt:fixed;border:none;mso-border-left-alt:0.5000pt solid windowtext;mso-border-top-alt:0.5000pt solid windowtext;mso-border-right-alt:0.5000pt solid windowtext;mso-border-bottom-alt:0.5000pt solid windowtext;mso-border-insideh:0.5000pt solid windowtext;mso-border-insidev:0.5000pt solid windowtext;mso-padding-alt:0.0000pt 5.4000pt 0.0000pt 5.4000pt ;" class="MsoNormalTable" border="1">
        <thead>
        	<tr>
        		<th colspan=17>
        			中学生心理健康诊断测验(EPQ)的报告详细
        		</th>
        	</tr>
            <tr>
            	<th rowspan=2>用户名</th>
                <th rowspan=2>真实姓名</th>
                <th rowspan=2>性别</th>
                <th rowspan=2>年龄</th>
                <th rowspan=2>部门</th>
                <th colspan=3>外倾性（E）</th>
                <th colspan=3>神经质（E）</th>
                <th colspan=3>精神质（P）</th>
                <th colspan=3>掩饰性（L）</th>
                
            </tr>
            <tr>
                <th>原始分</th>
                <th>标准分</th>
                <th>状态</th>
                <th>原始分</th>
                <th>标准分</th>
                <th>状态</th>
                <th>原始分</th>
                <th>标准分</th>
                <th>状态</th>
                <th>原始分</th>
                <th>标准分</th>
                <th>状态</th>
                
            </tr>
        </thead>
        <tbody>
            
            <%
            	for(int i=0;i<list.size();i++){
				VCheckReport report = (VCheckReport)list.get(i);
				List<TCheckReportItem> itemlist = DAOFactory.getCheckReoprtItemDAO().getCheckReportItemsByCheckID(report.getCheckid());	
		
             %>
             <tr>
                <td><%=report.getUsername() %></td>
                <td><%=report.getRealName() %></td>
                <td><%=report.getSex() %></td>
                <td><%=report.getCheckstuage()  %></td>
                <td><%=report.getClassName() %></td>
                <%
                	for(int j=0;j<itemlist.size();j++){
                		TCheckReportItem item = (TCheckReportItem)itemlist.get(j);
                		
                 %>
                 	<td><%=item.getOriginalscore() %></td>
                	<td><%=item.getStandardscore() %></td>
                	<td><%=item.getStatus() %></td>
	         <%
	         		}
	         %>
	         	 </tr> 
	         <% 	 
	         	}
	         
	          %>
        </tbody>
    </table>
    </div>
    <script src="../toexcel/js/jquery-3.3.1.min.js"></script>
    <script src="../toexcel/js/xlsx.core.min.js"></script>
    <script src="../toexcel/js/filesaver.js"></script>
    <script src="../toexcel/js/tableexport.js"></script>
    <script src="../toexcel/js/jquery.base64.js"></script>
    
    <script>
        function toExcel(){
           $('#myTable').tableExport({
            formats: ["xls"],
            fileName: "<%=sChecktime%><%=schoolname%><%=totalclassname%>(EPQ)报告详细",
            bootstrap: true
           });
        }
    </script>
</body>
    
</html>